package com.ruoyi.system.domain.upe;

import java.util.Hashtable;
import java.util.Vector;

public class Transition {
	// 状态迁移英文名称，系统自动生成，规则为:fromstate2tostate,如：START_HERE2BOSS类需求开发任务_待安排开发工作
	public String name;
	
	// 状态迁移中文名称
	public String alias;
	
	// 描述
	public String description;

	// 源状态英文名
	public String from_state;
	
	// 目标状态英文名
	public String to_state;
	
	// 排序序号
	public int sort_order;
	
	/*
	处理人脚本
	1）type：类型
	user: 指定用户ID，多个用户ID以逗号分隔
	role：指定角色ID，多个角色ID以逗号分割
	sql：SQL脚本，支持脚本中嵌入变量，变量值集合由调用者传入, SQL脚本必须以SELECT userid, username开头
	transition: 指定某个已经执行过的状态迁移名称，常用于回退等迁移的处理人配置
	java: 指定Java类，该类必须实现com.finedo.upe.UserScriptInterface接口
	2）script: 处理人脚本
	*/
	public UserScript user_script;
	
	/*
	迁移条件生效规则：如果无生效规则，condition_scripts节点可以不用配置
	1）type
	sql: SQL脚本，支持脚本中嵌入变量, 变量值集合由调用者传入, 该SQL必须以SELECT COUNT(..)开头
	当SQL执行后COUNT(1) >0 有效；
	当SQL执行后COUNT(1) == 0 无效；
	java: 指定Java类，该类必须实现com.finedo.upe.ConditionScriptInterface接口
	
	2）script: 规则脚本
	*/
	public ConditionScript condition_script;
	
	// 一票否决: true/false， 只有fromstate是会签节点才有效
	public boolean onevote=false;
	
	// 默认处理意见
	public String default_opinion;
	
	// 先决条件，配置java类(必须实现com.finedo.upe.api.Trigger)，支持配置多个，按序执行
	public Vector<String> pre_trigger;
	
	// 后续条件，配置java类(必须实现com.finedo.upe.api.Trigger)；支持配置多个，按序执行
	public Vector<String> post_trigger;
	
	// 状态迁移对话框定义
	public Hashtable<String, OAttribute> opt_attributes;
	
	public Transition() {
		
	}
	
	public Transition(String name, String alias, String description, String from_state, String to_state, int sort_order, UserScript user_script, ConditionScript condition_script, boolean onevote, String default_opinion, Vector<String> pre_trigger, Vector<String> post_trigger, Hashtable<String, OAttribute> opt_attributes) {
		this.name=name;
		this.alias=alias;
		this.description=description;
		this.from_state=from_state;
		this.to_state=to_state;
		this.sort_order=sort_order;
		this.user_script=user_script;
		this.condition_script=condition_script;
		this.onevote=onevote;
		this.default_opinion=default_opinion;
		this.pre_trigger=pre_trigger;
		this.post_trigger=post_trigger;
		this.opt_attributes=opt_attributes;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAlias() {
		return alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getFrom_state() {
		return from_state;
	}

	public void setFrom_state(String fromState) {
		from_state = fromState;
	}

	public String getTo_state() {
		return to_state;
	}

	public void setTo_state(String toState) {
		to_state = toState;
	}

	public int getSort_order() {
		return sort_order;
	}

	public void setSort_order(int sortOrder) {
		sort_order = sortOrder;
	}

	public UserScript getUser_script() {
		return user_script;
	}

	public void setUser_script(UserScript userScript) {
		user_script = userScript;
	}

	public ConditionScript getCondition_script() {
		return condition_script;
	}

	public void setCondition_script(ConditionScript conditionScript) {
		condition_script = conditionScript;
	}

	public Vector<String> getPre_trigger() {
		return pre_trigger;
	}

	public void setPre_trigger(Vector<String> preTrigger) {
		pre_trigger = preTrigger;
	}

	public Vector<String> getPost_trigger() {
		return post_trigger;
	}

	public void setPost_trigger(Vector<String> postTrigger) {
		post_trigger = postTrigger;
	}

	public Hashtable<String, OAttribute> getOpt_attributes() {
		return opt_attributes;
	}

	public void setOpt_attributes(Hashtable<String, OAttribute> optAttributes) {
		opt_attributes = optAttributes;
	}

	public boolean isOnevote() {
		return onevote;
	}

	public void setOnevote(boolean onevote) {
		this.onevote = onevote;
	}

	public String getDefault_opinion() {
		return default_opinion;
	}

	public void setDefault_opinion(String defaultOpinion) {
		default_opinion = defaultOpinion;
	}

	@Override
	public String toString() {
		return "Transition [name=" + name + ", alias=" + alias
				+ ", description=" + description + ", from_state=" + from_state
				+ ", to_state=" + to_state + ", sort_order=" + sort_order
				+ ", user_script=" + user_script + ", condition_script="
				+ condition_script + ", onevote=" + onevote
				+ ", default_opinion=" + default_opinion + ", pre_trigger="
				+ pre_trigger + ", post_trigger=" + post_trigger
				+ ", opt_attributes=" + opt_attributes + "]";
	}
	
}
